package com.alice.consumer.client;

import com.alice.consumer.client.fallback.ItemClientFallback;
import com.alice.consumer.pojo.Item;
import com.alice.consumer.pojo.ItemForm;
import com.alice.consumer.pojo.ItemVo;
import com.alice.consumer.utils.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * Created by caoxuel on 2020/9/23 11:53
 */
@FeignClient(value="item-service",fallback = ItemClientFallback.class)
public interface ItemsClient {
    @GetMapping("/item/{id}")
    Result queryById(@PathVariable Integer id);

    @GetMapping("/item/list")
    public Result queryAllItem();

    @DeleteMapping("/item/{id}")
    public Result deleteItem(@PathVariable Integer id);

    @PostMapping("/item/add")
    public Result addItem(@RequestBody ItemForm item);

    @PostMapping("/item/updateItem")
    public Result updateItem(@RequestBody ItemForm item);

    @PostMapping("/item/{page}/{limit}")
    public Result queryListPage(@PathVariable Integer page,
                                @PathVariable Integer limit,
                                @RequestBody(required = false) ItemVo item);
}
